package com.atguigu.lease.common.minio;


import io.minio.MinioClient;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @author Ruchan
 * @title MinioConfiguration
 * @date 2024/10/31 17:24
 * @description 
 */
@Configuration
@ConditionalOnProperty("minio.endpoint")
public class MinioConfiguration {
    @Autowired
    MinioProperties minioProperties;

    @Bean
    public MinioClient getMinioClient(){
        return MinioClient.builder()
                .endpoint(minioProperties.getEndpoint())
                .credentials(minioProperties.getAccessKey(), minioProperties.getSecretKey())
                .build();
    }
}
